import logging
from redis import StrictRedis


class Config(object):
    SECRET_KEY = "0wBpedFTDJ3rqB078ymZqIziP8JVOrsKT5ITN5emij4jqKW0nbCUvgoQu+6Z4pR5"
    SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@127.0.0.1:3306/test_study"
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True
    SESSION_TYPE = "redis"
    SESSION_PERMANENT = False
    SESSION_USE_SIGNER = True
    PERMANENT_SESSION_LIFETIME = 86400 * 2
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379
    SESSION_REDIS = StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    LOG_LEVEL = logging.DEBUG


class DevelopmentConfig(Config):
    DEBUG = True


class ProductingConfig(Config):
    DEBUG = False
    LOG_LEVEL = logging.ERROR


class TestingConfig(Config):
    DEBUG = True
    TESTING = True


config = {
    "development": DevelopmentConfig,
    "producting": ProductingConfig,
    "testing": TestingConfig
}